<template>
  <div class="box" style=" ">
        <el-card :body-style="{ padding: '0px' }" shadow="hover" class="login-box" style="border-radius: 10px">
          <el-tabs  type="card">
            <el-tab-pane>
              <span slot="label" style="font-size: 18px">登录</span>
              <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="70px" size="medium" >
                <!--<div><p style="text-align: center;margin: 5px;font-size: 20px"><b>登录</b></p></div>-->
                <el-form-item label="用户名" prop="username">
                  <el-input  v-model="ruleForm.username" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item label="密    码" prop="password">
                  <el-input type="password" show-password v-model="ruleForm.password" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item label="验证码" prop="vercode">
                  <el-input v-model.number="ruleForm.vercode" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item style="float: right;margin-right: 50px">
                  <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
                  <el-button @click="resetForm('ruleForm')">重置</el-button>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <el-tab-pane >
              <span slot="label" style="font-size: 18px">注册</span>
              <el-form :model="registerForm" status-icon :rules="rules" ref="registerForm" label-width="70px" >
                <!--<div><p style="text-align: center;margin: 5px;font-size: 20px"><b>注册</b></p></div>-->
                <el-form-item label="用户名" prop="username">
                  <el-input  v-model="registerForm.username" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item label="密    码" prop="password">
                  <el-input type="password" show-password v-model="registerForm.password" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item label="验证码" prop="vercode">
                  <el-input v-model.number="registerForm.vercode" style="width: 300px"></el-input>
                </el-form-item>
                <el-form-item style="float: right;margin-right: 50px">
                  <el-button type="primary" @click="register('registerForm')">提交</el-button>
                  <el-button @click="resetForm('registerForm')">重置</el-button>
                </el-form-item>
              </el-form>
            </el-tab-pane>
          </el-tabs>
        </el-card>

  </div>
</template>

<script>
export default {
  data() {
    var checkVercode = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('验证码不能为空'));
      }
    };
    var checkUsername = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入用户名'));
      }
    };
    var checkPassword = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入密码'));
      }
    };
    return {
      ruleForm: {
        username: '',
        password: '',
        vercode: ''
      },
      registerForm: {
        username: '',
        password: '',
        vercode: ''
      },
      activeName: '',
      rules: {
        username: [
          { validator: checkUsername, trigger: 'blur' }
        ],
        password: [
          { validator: checkPassword, trigger: 'blur' }
        ],
        vercode: [
          { validator: checkVercode, trigger: 'blur' }
        ]
      }
    };
  },
  methods: {
    submitForm(formName) {

    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    register(registerForm){

    }
  },
}
</script>
<style scoped>
.login-box{
  border:1px solid #DCDFE6;
  width: 430px;
  margin: 150px auto;
 /* padding: 35px 35px 15px 35px;*/
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  box-shadow: 0 0 25px #909399;
}
.box{
  height: 100vh;
  overflow: hidden;
   /* background-color: rebeccapurple;*/
    background-image: linear-gradient(to right , #7A88FF, #7AFFAF);
}


</style>